#include <stdio.h>
int main()
{
	int arr[100] = { 0 }, num[100] = { 0 },more[100] = { 0 };
	int i = 0, n = 0, aim = 0, j = 0,max=0,b=0;
	scanf("%d", &n);
	for (i = 0; i < n; i++)
	{
		scanf("%d", &arr[i]);
	}
	for (i = 0; i < n; i++)
	{
		aim=arr[i];
		for (j = 0;j < n;j++)
		{
			if (arr[j] == aim)
			{
				num[j]++;
			}
		}
	}
	for (i = 0; i < n; i++)
	{
		if (num[i] > max)
		{
			max = num[i];
		}
	}
	for (i = 0; i < n; i++)
	{
		if (num[i] == max)
		{
			more[b] = arr[i];
			b++;
		}
	}
	int mid = 0;
	for (i = 0;i < b - 1;i++)
	{
		for (j = 0;j < b - 1-i;j++)
		{
			if (more[j] > more[j + 1])
			{
				mid = more[j];
				more[j] = more[j + 1];
				more[j + 1] = mid;
			}
		}
	}
	for (i = 0; i < b; i += max)
	{
		printf("%d %d\n", more[i],max);
	}
	return 0;
}
